import type { RouteRecordRaw } from 'vue-router'
import { shallowRef } from 'vue'
import IconMenuEducation from '~icons/local/menu-education-color'
import { Layout } from '../constant'

// 班级教务
const classModule: RouteRecordRaw = {
  path: 'class',
  name: 'class',
  meta: {
    title: '班级教务',
    group: true,
  },
  children: [
    {
      path: 'enroll/list',
      name: 'EnrollIndex',
      component: () => import('@/views/education/enroll/index.vue'),
      meta: {
        title: '报名记录',
        code: 'edu:enroll:read',
        icon: 'icon-bookmark',
      },
    },
    {
      path: 'enroll/detail',
      name: 'EnrollDetail',
      component: () => import('@/views/education/enroll/detail.vue'),
      meta: {
        title: '报名详情',
        code: 'edu:enroll:read',
        icon: 'icon-dashboard',
        hidden: true,
      },
    },
    {
      path: 'list',
      name: 'ClassIndex',
      component: () => import('@/views/education/class/index.vue'),
      meta: {
        title: '班级列表',
        code: 'edu:class:read',
        icon: 'icon-list',
      },
    },
    {
      path: 'create',
      name: 'ClassCreate',
      component: () => import('@/views/education/class/create.vue'),
      meta: {
        title: '创建班级',
        code: 'edu:class:write',
        hidden: true,
      },
    },
    {
      path: 'batch-create',
      name: 'ClassBatchCreate',
      component: () => import('@/views/education/class/ClassBatchCreate.vue'),
      meta: {
        title: '批量创建班级',
        code: 'edu:class:write',
        hidden: true,
      },
    },
    {
      path: 'detail',
      name: 'ClassDetail',
      component: () => import('@/views/education/class/detail.vue'),
      meta: {
        title: '班级详情',
        code: 'edu:class:read',
        hidden: true,
      },
    },
    {
      path: 'change/list',
      name: 'ClassChangeRecord',
      component: () => import('@/views/education/change/index.vue'),
      meta: {
        title: '转班调课',
        code: 'edu:class-change:manage',
        icon: 'icon-translate',

      },
    },
    {
      path: 'change/create',
      name: 'ClassChangeCreate',
      component: () => import('@/views/education/change/ChangeCreateView.vue'),
      meta: {
        title: '发起转班调课',
        code: 'edu:class-change:manage',
        hidden: true,

      },
    },
    {
      path: 'cancel/list',
      name: 'ClassCancelRecord',
      component: () => import('@/views/education/cancel/index.vue'),
      meta: {
        title: '退班退课',
        code: 'edu:class-cancel:manage',
        icon: 'icon-export',
      },
    },
    {
      path: 'cancel/create',
      name: 'ClassCancelCreate',
      component: () => import('@/views/education/cancel/CancelCreateView.vue'),
      meta: {
        title: '发起退班退课',
        code: 'edu:class-cancel:manage',
        hidden: true,
      },
    },
  ],
}
// 家校互动
const interaction: RouteRecordRaw = {
  path: 'interaction',
  name: 'interaction',
  meta: {
    title: '家校互动',
    group: true,
  },
  children: [
    {
      path: 'exam/list',
      name: 'Exam',
      component: () => import('@/views/education/exam/index.vue'),
      meta: {
        title: '考试成绩',
        code: 'edu:exam:read',
        icon: 'icon-book',
      },
    },
    {
      path: 'exam/detail',
      name: 'ExamDetai',
      component: () => import('@/views/education/exam/ExamDetail.vue'),
      meta: {
        title: '考试详情',
        code: 'edu:exam:read',
        hidden: true,
      },
    },
    // {
    //   path: 'evaluation',
    //   name: 'Evaluation',
    //   component: () => import('@/views/education/rate/index.vue'),
    //   meta: {
    //     title: '上课评价',
    //     code: 'edu:evaluation:read',
    //     icon: 'icon-thumb-up',
    //   },
    // },
  ],
}

// 课程表
const schedule: RouteRecordRaw = {
  path: 'schedule',
  name: 'schedule',
  meta: {
    title: '课程表',
    group: true,
  },
  children: [
    {
      path: 'classroom',
      name: 'ClassroomSchedule',
      component: () => import('@/views/education/schedule/classroom.vue'),
      meta: {
        title: '教室课表',
        code: 'edu:schedule:read',
        icon: 'icon-calendar-clock',
      },
    },
    {
      path: 'class',
      name: 'ClassScheduleTable',
      component: () => import('@/views/education/schedule/ClassScheduleTable.vue'),
      meta: {
        title: '班级课表',
        code: 'edu:schedule:read',
        icon: 'icon-calendar',
      },
    },
  ],
}

export default <RouteRecordRaw>{
  path: '/education',
  component: Layout,
  meta: {
    title: '教务中心',
    icon: shallowRef(IconMenuEducation),
    sort: 3,
  },
  children: [
    classModule,
    schedule,
    interaction,
  ],
}
